/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>
#include <memory>

#include "se_param_manager.h"

#include "loghelper.h"

namespace OHOS {
namespace SE {
namespace TEST {

using namespace testing::ext;
class SeParamManagerTest : public testing::Test {
public:
    static void SetUpTestCase();
    static void TearDownTestCase();
    void SetUp();
    void TearDown();
};

void SeParamManagerTest::SetUpTestCase()
{
    std::cout << " SetUpTestCase SeParamManagerTest." << std::endl;
}

void SeParamManagerTest::TearDownTestCase()
{
    std::cout << " TearDownTestCase SeParamManagerTest" << std::endl;
}

void SeParamManagerTest::SetUp()
{
    std::cout << " SetUp SeParamManagerTest." << std::endl;
}

void SeParamManagerTest::TearDown()
{
    std::cout << " TearDown SeParamManagerTest." << std::endl;
}

std::string g_paramManagerTestErrorLog;
void ParamManagerTestLogCallback(
    const LogType type, const LogLevel level, const unsigned int domain, const char *tag, const char *msg)
{
    g_paramManagerTestErrorLog = msg;
}

/**
 * @tc.name: InitializeParams001
 * @tc.desc: Test SeParamManagerTest InitializeParams
 * @tc.type: FUNC
 */
HWTEST_F(SeParamManagerTest, InitializeParams001, TestSize.Level1)
{
    LOG_SetCallback(ParamManagerTestLogCallback);
    SeParamManager::GetInstance().InitializeParams();
    EXPECT_TRUE(g_paramManagerTestErrorLog.find("load string from file") == std::string::npos);
}

/**
 * @tc.name: GetAppSignatureMap001
 * @tc.desc: Test SeParamManagerTest GetAppSignatureMap
 * @tc.type: FUNC
 */
HWTEST_F(SeParamManagerTest, GetAppSignatureMap001, TestSize.Level1)
{
    std::map<std::string, std::vector<std::string>> map = SeParamManager::GetInstance().GetAppSignatureMap();
    EXPECT_TRUE(map.size() == 0);
}
} // namespace TEST
} // namespace SE
} // namespace OHOS
